﻿    <ResourceDictionary
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:comp="clr-namespace:Morphing.Components">
        
    <Style TargetType="{x:Type comp:Scene}">
        <Setter Property="Focusable" Value="False"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate>
                    <Grid HorizontalAlignment="Left" VerticalAlignment="Top">
                        <Canvas Name="layerImage"/>
                        <Canvas Name="layerGrid" Opacity="0">
                            <Canvas Name="layerNodes" />
                            <Canvas.Resources>
                                <Style TargetType="{x:Type Polyline}">
                                    <Setter Property="SnapsToDevicePixels" Value="True" />
                                    <Setter Property="StrokeThickness" Value="1" />
                                    <Setter Property="Stroke" Value="#555" />
                                </Style>
                            </Canvas.Resources>
                        </Canvas>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Trigger.EnterActions>
                                <BeginStoryboard>
                                    <Storyboard TargetName="layerGrid">
                                        <DoubleAnimation To="1" Storyboard.TargetProperty="Opacity" Duration="0:0:0.5" />
                                    </Storyboard>
                                </BeginStoryboard>
                        </Trigger.EnterActions>
                            <Trigger.ExitActions>
                                <BeginStoryboard>
                                    <Storyboard TargetName="layerGrid">
                                        <DoubleAnimation To="0" Storyboard.TargetProperty="Opacity" Duration="0:0:0.2" />
                                    </Storyboard>
                                </BeginStoryboard>
                            </Trigger.ExitActions>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="Node" TargetType="{x:Type Ellipse}">
        <Setter Property="Width" Value="20" />
        <Setter Property="Height" Value="20" />
        <Setter Property="Fill">
            <Setter.Value>
                <RadialGradientBrush>
                    <RadialGradientBrush.GradientStops>
                        <GradientStop Color="Black" Offset="0.25" />
                        <GradientStop Color="WhiteSmoke" Offset="0.35" />
                        <GradientStop Color="Transparent" Offset="0.35" />
                        <GradientStop Color="Transparent" Offset="1" />
                    </RadialGradientBrush.GradientStops>
                </RadialGradientBrush>
            </Setter.Value>
        </Setter>
        <Setter Property="RenderTransform">
            <Setter.Value>
                <ScaleTransform ScaleX="1" ScaleY="1" CenterX="10" CenterY="10" />
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="ControlNode" BasedOn="{StaticResource Node}" TargetType="{x:Type Ellipse}">
        <Setter Property="Fill">
            <Setter.Value>
                <RadialGradientBrush>
                    <RadialGradientBrush.GradientStops>
                        <GradientStop Color="LightGray" Offset="0.25" />
                        <GradientStop Color="Black" Offset="0.40" />
                        <GradientStop Color="Transparent" Offset="0.40" />
                        <GradientStop Color="Transparent" Offset="1" />
                    </RadialGradientBrush.GradientStops>
                </RadialGradientBrush>
            </Setter.Value>
        </Setter>
    </Style>
        
    <Storyboard x:Key="NodeFadeIn">
        <DoubleAnimation To="2" Storyboard.TargetProperty="(FrameworkElement.RenderTransform).(ScaleTransform.ScaleX)" Duration="0:0:0.1" />
        <DoubleAnimation To="2" Storyboard.TargetProperty="(FrameworkElement.RenderTransform).(ScaleTransform.ScaleY)" Duration="0:0:0.1" />
    </Storyboard>

    <Storyboard  x:Key="NodeFadeOut">
        <DoubleAnimation To="1" Storyboard.TargetProperty="(FrameworkElement.RenderTransform).(ScaleTransform.ScaleX)" Duration="0:0:0.1" />
        <DoubleAnimation To="1" Storyboard.TargetProperty="(FrameworkElement.RenderTransform).(ScaleTransform.ScaleY)" Duration="0:0:0.1" />
    </Storyboard>

</ResourceDictionary>